﻿﻿#region License
// iMenu - iOS Style Menu for Windows OSes
// Copyright (C) 2011
// 
// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
#endregion

using System;
using System.Collections.Generic;
using System.Text;
using System.Diagnostics;
using System.IO;

namespace iMenu.DebugClass
{
    /// <summary>
    /// Class for Logging.
    /// Includes Error and Exceptions Logging.
    /// </summary>
    internal static class Log{
        private static  StreamWriter _TxtLogger = new StreamWriter(Environment.CurrentDirectory + "\\iMenu.log");



         /// <summary>
         /// Logs an Exception, use in Try-Catch Methods.
         /// </summary>
         /// <param name="Exception">Exception to Log.</param>
         internal static  void Exception(Exception Exception)
         {
             Debug.WriteLine(DateTime.Now +  "[EXCEPTION]" + Exception.Message);
             _TxtLogger.WriteLine(DateTime.Now +  "[EXCEPTION]" + Exception.Message);
             _TxtLogger.Flush();
         }

         /// <summary>
         /// Logs an error ([ERROR]Error Message) is the syntax in the log.
         /// </summary>
         /// <param name="Error">Error Message, it'll be shown near [ERROR] tag.</param>
         internal static void Error(string Error)
         {
             Debug.WriteLine(DateTime.Now + "[ERROR]" + Error);
                _TxtLogger.WriteLine(DateTime.Now + "[ERROR]" + Error);
                _TxtLogger.Flush();
         }

         /// <summary>
         /// Logs a warning ([WARNING]Warn Message) is the syntax in the log.
         /// </summary>
         /// <param name="Warning">Warning Message, it'll be shown near [WARNING] tag.</param>
         internal static void Warn(string Warning)
         {
             Debug.WriteLine( DateTime.Now +"[WARNING]" + Warning);
             _TxtLogger.WriteLine(DateTime.Now + "[WARNING]" + Warning);
             _TxtLogger.Flush();
         }

         /// <summary>
         /// Logs a Info Message ([INFO]Information) is the syntax in the log.
         /// </summary>
         /// <param name="Info">Info Message, it'll be shown near [INFO] tag.</param>
         internal static  void Info(string Info)
         {
             Debug.WriteLine( DateTime.Now + "[INFO]" + Info);
             _TxtLogger.WriteLine(DateTime.Now + "[INFO]" + Info);
             _TxtLogger.Flush();
         }
      
    
    }

}
